package com.edgegateway.system.service.impl;

import java.util.Date;
import java.util.List;

import com.edgegateway.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.edgegateway.system.mapper.IotEdgeGatewayMapper;
import com.edgegateway.system.domain.IotEdgeGateway;
import com.edgegateway.system.service.IIotEdgeGatewayService;
import com.edgegateway.common.core.text.Convert;

import javax.annotation.Resource;

/**
 * 边缘网关Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-01-03
 */
@Service
public class IotEdgeGatewayServiceImpl implements IIotEdgeGatewayService 
{
    @Resource
    private IotEdgeGatewayMapper iotEdgeGatewayMapper;

    /**
     * 查询边缘网关
     * 
     * @param id 边缘网关主键
     * @return 边缘网关
     */
    @Override
    public IotEdgeGateway selectIotEdgeGatewayById(String id)
    {
        return iotEdgeGatewayMapper.selectIotEdgeGatewayById(id);
    }

    /**
     * 查询边缘网关列表
     * 
     * @param iotEdgeGateway 边缘网关
     * @return 边缘网关
     */
    @Override
    public List<IotEdgeGateway> selectIotEdgeGatewayList(IotEdgeGateway iotEdgeGateway)
    {
        return iotEdgeGatewayMapper.selectIotEdgeGatewayList(iotEdgeGateway);
    }

    /**
     * 新增边缘网关
     * 
     * @param iotEdgeGateway 边缘网关
     * @return 结果
     */
    @Override
    public int insertIotEdgeGateway(IotEdgeGateway iotEdgeGateway)
    {
        iotEdgeGateway.setCreatedTime(new Date());
        return iotEdgeGatewayMapper.insertIotEdgeGateway(iotEdgeGateway);
    }

    /**
     * 修改边缘网关
     * 
     * @param iotEdgeGateway 边缘网关
     * @return 结果
     */
    @Override
    public int updateIotEdgeGateway(IotEdgeGateway iotEdgeGateway)
    {
        iotEdgeGateway.setUpdatedTime(new Date());
        return iotEdgeGatewayMapper.updateIotEdgeGateway(iotEdgeGateway);
    }

    /**
     * 批量删除边缘网关
     * 
     * @param ids 需要删除的边缘网关主键
     * @return 结果
     */
    @Override
    public int deleteIotEdgeGatewayByIds(String ids)
    {
        return iotEdgeGatewayMapper.deleteIotEdgeGatewayByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除边缘网关信息
     * 
     * @param id 边缘网关主键
     * @return 结果
     */
    @Override
    public int deleteIotEdgeGatewayById(String id){
        return iotEdgeGatewayMapper.deleteIotEdgeGatewayById(id);
    }

    @Override
    public List<IotEdgeGateway> getAll() {
        return iotEdgeGatewayMapper.getAll();
    }
}
